package com.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class RedisManager {

	private static JedisPool pool ; 
	static String host = "47.100.222.132";
	static int port = 6379;
	static int timeout = 5000;
	static String password = "wlz@redis";
	
	private RedisManager() { }
	
	static {
		JedisPoolConfig pconfig = new JedisPoolConfig();
		pconfig.setMaxTotal(20);
		pconfig.setMaxIdle(1);
		pool = new JedisPool(pconfig, host, port, timeout, password);
	}
	
	public static Jedis getJedis() {
		Jedis jedis = pool.getResource();
		return jedis;
	}
}
